package com.myaihui.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2018/6/24
 * *******************************
 */
public class EncryptUtil {

    public static String passwordEncrypt(String username, String password){
        int hashIterations = 4;
        String algorithmName= "MD5";
        ByteSource credentialsSalt = ByteSource.Util.bytes(username);
        Object obj = new SimpleHash(algorithmName, password, credentialsSalt, hashIterations);
        return obj.toString();
    }
}
